home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 24 / CU Amiga Magazine's Super CD-ROM 24 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-07].iso / CUCD / Programming / BlitzList / BlitzListFiles / WritePixelArray8.asc < prev    next >
Encoding:
Text File  |  1998-05-04  |  1.4 KB  |  50 lines

  1. ; This example will fill an array with bytes taken from the data statements.
  2. ; Each byte can be anything from 0-255 but I've only used 0-3. The result
  3. ; should be a very small window with the image drawn in the center.
  4.  
  5. FindScreen 0
  6. Window 0,50,50,35,35,0,"",0,0
  7.  
  8. Dim chunk.b(15,15)
  9. Restore dat
  10. For y.w=0 To 15 : For x.w=0 To 15 : Read chunk(x,y) : Next x : Next y
  11.  
  12. ; Write this array to the window starting at 10,10
  13. ; and ending at 25,15, the result is a 16x16 blit.
  14.  
  15. *trp.RastPort=AllocMem_(SizeOf.RastPort,#MEMF_ANY|#MEMF_CLEAR)
  16. *bm.BitMap=AllocBitMap_(((16+15) LSL 4) LSR 1,1,8,#BMF_CLEAR,0)
  17. InitRastPort_ *trp
  18. *trp\Layer=0
  19. *trp\_BitMap=*bm
  20.  
  21. WritePixelArray8_ RastPort(0),10,10,25,25,&chunk(0,0),*trp
  22.  
  23. MouseWait
  24.  
  25. FreeBitMap_ *bm
  26. FreeMem_ *trp,SizeOf.RastPort
  27.  
  28. End
  29.  
  30. dat:
  31. Data.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  32. Data.b 0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0
  33. Data.b 0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0
  34. Data.b 0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0
  35. Data.b 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0
  36. Data.b 0,0,1,1,0,0,0,3,3,0,0,0,1,1,0,0
  37. Data.b 0,0,1,1,0,0,0,3,3,0,0,0,1,1,0,0
  38. Data.b 0,1,2,2,1,3,3,1,1,3,3,1,2,2,1,0
  39. Data.b 0,1,2,2,1,3,3,1,1,3,3,1,2,2,1,0
  40. Data.b 0,0,1,1,0,0,0,3,3,0,0,0,1,1,0,0
  41. Data.b 0,0,1,1,0,0,0,3,3,0,0,0,1,1,0,0
  42. Data.b 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0
  43. Data.b 0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0
  44. Data.b 0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0
  45. Data.b 0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0
  46. Data.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  47.  
  48.  
  49.  
  50.